
angular.module("myKitchen")
.service("homeService",function($http){
    this.getCarousel = function(callback){
        $http.get("./public/data/homeData/home_first.json").success(callback)
    }
    this.getGoodItems = function(callback){
        $http.get("./public/data/homeData/home_second.json").success(callback)
    }
    this.getCarouselItems = function(callback){
		$http.get("./public/data/homeData/carouselItems.json").success(callback)
	}

	var goodItemArr = []
	this.addGoodItems = function(item){
		var idx = goodItemArr.indexOf(item)
		if(idx == -1)
			goodItemArr.push(item)
		else
			goodItemArr[idx] = item;
		console.log(goodItemArr)
	}

	this.sendGoodItems = function(){
		return goodItemArr;
	}


	var itemTitle;
	this.addCarouselItemTitle = function(item){
		itemTitle = item;
	}
	this.sendCarouselItemTitle = function(){
		return itemTitle;
	}


	var itemArr = []
	this.addCarouselItems = function(item){
		var idx = itemArr.indexOf(item)
		if(idx == -1)
			itemArr.push(item)
		else
			itemArr[idx] = item;
	}

	this.sendCarouselItems = function(){
		return itemArr;
	}

})
